# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
  
  # 2012.08.28
  def show_category_name
    normal = "标签"
    category = Category.find_by_id(params[:category])
    if category
      normal = category.name
    end
    return normal
  end
  
  # 2012.08.28
  def show_category
    categories = Category.all
    html = ""
    html << "<span class=\"SubmenuColumn\">"
    categories.each_with_index do |category, i|
      html << "<a class='#{'selected' if params[:category].to_i == category.id}' href=\"/all/?category=#{category.id}\">#{category.name}</a>"
      if i == 13
        html << "</span>"
        html << "<span class=\"SubmenuColumn\">"
      end
    end
    html << "</span>"
    html
  end
  
end
